#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int d[8], ans;

int main(int argc, char const *argv[])
{
	freopen("init.in", "r", stdin);

	for (int i = 1; i <= 7; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		d[i] = a + b - 8;

		if (d[i] > d[ans])
			ans = i;
	}

	printf("%d\n", ans);
	return 0;
}
